<?php
include "connection-provider.php";
	
	$studentID = $_GET['studentID'];
			$result = mysqli_query($con,"SELECT * FROM `login_details` WHERE userID='$studentID'");		
			while($row = mysqli_fetch_array($result))
				{
					echo "<h3>Answer Sheet of " . $row['UserName']. " ( Roll No. - ". $row['UserRollNo'] . ")</h3>";
				}
	
	
	$result = mysqli_query($con,"SELECT * FROM question_table LEFT JOIN answer_sheet on question_table.questionNumber = answer_sheet.QuesID where answer_sheet.StudentID = '$studentID' && answer_sheet.typeId='1' order by question_table.typeId");


	echo "<h3>Aptitude Questions</h3>";
	
	while($row = mysqli_fetch_array($result))
	{	
		echo $row['questionNumber'] . ". ";
		echo $row['question'] . "<br/>" ;
?>		
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value="<?php echo $row['optionOne']; ?>"  <?php  if($row['Answer'] == $row['optionOne']){ echo "checked = \"checked\"";} ?> > <?php  if($row['Answer'] == $row['optionOne']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionOne']; ?></span> <br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionTwo']; ?>" <?php  if($row['Answer'] == $row['optionTwo']){ echo "checked = \"checked\"";} ?>>  <?php  if($row['Answer'] == $row['optionTwo']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionTwo']; ?> </span><br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionThree']; ?>"  <?php  if($row['Answer'] == $row['optionThree']){ echo "checked = \"checked\"";} ?> >  <?php if($row['Answer'] == $row['optionThree']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?> <?php echo $row['optionThree']; ?> </span><br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionFour']; ?> "  <?php  if($row['Answer'] == $row['optionFour']){ echo "checked = \"checked\"";} ?> >  <?php  if($row['Answer'] == $row['optionFour']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionFour']; ?> </span><br><br>
<?php
	}

$result = mysqli_query($con,"SELECT * FROM question_table LEFT JOIN answer_sheet on question_table.questionNumber = answer_sheet.QuesID where answer_sheet.StudentID = '$studentID' && answer_sheet.typeId='2' order by question_table.typeId");	
echo "<h3>Computer Science Questions</h3>";	
	while($row = mysqli_fetch_array($result))
	{	
		echo $row['questionNumber'] . ". ";
		echo $row['question'] . "<br/>" ;
?>		
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value="<?php echo $row['optionOne']; ?>"  <?php  if($row['Answer'] == $row['optionOne']){ echo "checked = \"checked\"";} ?> > <?php  if($row['Answer'] == $row['optionOne']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionOne']; ?></span> <br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionTwo']; ?>" <?php  if($row['Answer'] == $row['optionTwo']){ echo "checked = \"checked\"";} ?>>  <?php  if($row['Answer'] == $row['optionTwo']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionTwo']; ?> </span><br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionThree']; ?>"  <?php  if($row['Answer'] == $row['optionThree']){ echo "checked = \"checked\"";} ?> >  <?php if($row['Answer'] == $row['optionThree']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?> <?php echo $row['optionThree']; ?> </span><br/>
		<input type= "radio" name="<?php echo $row['questionNumber']?>" value= "<?php echo $row['optionFour']; ?> "  <?php  if($row['Answer'] == $row['optionFour']){ echo "checked = \"checked\"";} ?> >  <?php  if($row['Answer'] == $row['optionFour']) {if($row['Result'] == "Correct"){ echo "<span style=\"color: Green\">";} else {echo "<span style=\"color: Red\">";}} ?><?php echo $row['optionFour']; ?> </span><br><br>
<?php
	}
?>